package com.lanqiao.javaparkinglot.dao;


import com.lanqiao.javaparkinglot.entity.Wliu;
import org.apache.ibatis.annotations.*;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
public interface WliuDao {
    //查询
    @Select("select * from wl_table")
    List<Wliu> findAll();

    //模糊查询--货主姓名
    @Select("select * from wl_table where wl_number like #{wl_number}")
    List<Wliu> findByNumber(String wl_number);
    //模糊查询车辆类型
    @Select("select * from wl_table where wl_car like #{wl_car}")
    List<Wliu> findByCar (String wl_car);
    //模糊查询货物类型
    @Select("select * from wl_table where wl_hwstyle like #{wl_hwstyle}")
    List<Wliu>findHws (String wl_hwstyle);



    //添加
    @Update("insert into wl_table (wl_eno, wl_time, wl_company, wl_hwstyle, wl_ton, wl_source, wl_location, wl_car, wl_number, wl_telephone) VALUES (#{wl_eno},#{wl_time},#{wl_company},#{wl_hwstyle},#{wl_ton},#{wl_source},#{wl_location},#{wl_car},#{wl_number},#{wl_telephone}) ")
    @Transactional
   void  addwliu(Wliu wliu);

    //修改
    @Update("update wl_table  set wl_eno=#{wl_eno},wl_time=#{wl_time},wl_company=#{wl_company},wl_hwstyle=#{wl_hwstyle},wl_ton=#{wl_ton},wl_source=#{wl_source},wl_location=#{wl_location},wl_car=#{wl_car},wl_number=#{wl_number},wl_telephone=#{wl_telephone} where wl_eno=#{wl_eno} ")
    @Transactional
    void updatewliu(Wliu wliu);


    //删除
    @Delete("delete from  wl_table where wl_eno=#{wl_eno}")
    void deletewliu(Long wl_eno);

    //分页查询
    @Select("select * from wl_table limit #{offset},#{pageSize}")
    List<Wliu> findByPage(@Param("offset")Integer offset,@Param("pageSize")Integer pageSize);

    @Select("select count(wl_eno) from wl_table")
    Integer countWliu();
}





















